home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / inwineq2.zip / INWINEQ2.ASM < prev   
Assembly Source File  |  1992-02-04  |  2KB  |  69 lines

  1. PAGE    58,132
  2. TITLE    INWINEQ1    11-19-91    [2-4-92]
  3.  
  4. ;v1.1 Toad Hall Disassembly and Tweak,
  5. ;4 Feb 92
  6. ;Don't you just *love* it when people refuse
  7. ;to distribute source for such trivial utilities?
  8. ;David Kirschbaum, Toad Hall
  9. ;kirsch@usasoc.soc.mil
  10.  
  11. CSEG    SEGMENT
  12.     ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
  13.     ORG    100H
  14.  
  15. InWinEq    PROC    NEAR
  16.     MOV    AX,DS:2CH    ;PSP environment segment
  17.     MOV    ES,AX
  18. ;v1.1    MOV    DI,0
  19.     xor    di,di        ;0 offset                v1.1
  20.  
  21. ;Compare this environment string against 'windir='
  22. StringLup_108:
  23.     MOV    AL,ES:[DI]    ;snarf environment byte
  24. ;v1.1    CMP    AL,0
  25.     or    al,al        ;environment's terminating 0?        v1.1
  26.     JZ    Term_134    ;yep, terminate
  27.  
  28.     MOV    SI,OFFSET txt13D    ;'windir='
  29.  
  30. ;Scan the string, char by character.
  31. CharLup_112:
  32.     MOV    BL,[SI]        ;snarf 'windir=' char
  33. ;v1.1    CMP    BL,0
  34.     or    bl,bl        ;terminating 0?                v1.1
  35.     JZ    Match_12F    ;yep, complete match, flag found
  36.  
  37.     MOV    AL,ES:[DI]    ;snarf environment character
  38.     CMP    AL,BL        ;match the 'windir=' char?
  39.     JNZ    NoMatch_124    ;nope, no match
  40.  
  41.     INC    DI        ;char matched, bump both pointers
  42.     INC    SI
  43.     JMP    CharLup_112    ;and keep matching
  44.  
  45. NoMatch_124:
  46.     INC    DI        ;bump environment pointer
  47.     MOV    AL,ES:[DI]    ;snarf environment character
  48.     OR    AL,AL        ;terminating 0 for this string?
  49.     JNZ    NoMatch_124    ;nope, keep looking
  50.     INC    DI        ;yep, bump past this string's 0
  51.     JMP    StringLup_108    ;and check a whole new string
  52.  
  53. Match_12F:
  54. ;v1.1    MOV    BYTE PTR bflag13C,1    ;flag 'windir=' found
  55.     inc    bflag13C        ;flag 'windir=' found        v1.1
  56. Term_134:
  57.     MOV    AH,4CH        ;terminate process
  58.     MOV    AL,bflag13C    ;ERRORLEVEL 1 if 'windir=' found
  59.     INT    21H
  60.  
  61. bflag13C db    0        ;default 0, no 'windir=' found
  62.  
  63. txt13D    DB    'windir=',0
  64.  
  65. InWinEq    ENDP
  66.  
  67. CSEG    ENDS
  68.     END    InWinEq
  69.